<template>
	<view class="order-detail-layout">
		<!-- 商户信息 -->
		<view class="order-detail-list">
			<view class="order-detail-list-item">
				<text>商户名称</text>
				<text>{{$uv.test.empty(jsonData.merName) ? jsonData.mercName : jsonData.merName}}</text>
				<view class="line"></view>
			</view>
			<view class="order-detail-list-item">
				<text>商户编号</text>
				<text>{{$uv.test.empty(jsonData.merNo) ? jsonData.mercNo : jsonData.merNo}}</text>
				<view class="line"></view>
			</view>
		</view>
		<!-- 交易信息 -->
		<view class="order-detail-info">
			<view>
				<view class="order-detail-info-money">￥{{props.type == '1' ? jsonData.transAmount : jsonData.amount}}</view>
				<view class="order-detail-info-item">
					<text>交易时间</text>
					<text>{{$uv.test.empty(jsonData.transTime) ? jsonData.dateTime : jsonData.transTime}}</text>
				</view>
				<!-- 交易订单信息 -->
				<view v-if="props.type == '0'">
					<view class="order-detail-info-item">
						<text>交易方式</text>
						<text>{{jsonData.type}}</text>
					</view>
					<view class="order-detail-info-item">
						<text>交易金额</text>
						<text>￥{{jsonData.amount}}</text>
					</view>
					<view class="order-detail-info-item">
						<text>交易费率</text>
						<text>{{jsonData.transactionRate}}%</text>
					</view>
					<view class="order-detail-info-item">
						<text>交易手续费</text>
						<text>￥{{jsonData.commissionCharges}}</text>
					</view>
					<view class="order-detail-info-item">
						<text>秒到提现费</text>
						<text>{{jsonData.singleCost}}元/笔</text>
					</view>
				</view>
				<view v-if="props.type == '1'">
					<view class="order-detail-info-item">
						<text>流量卡</text>
						<text>￥{{jsonData.transAmount}}</text>
					</view>
				</view>
				<view v-if="props.type == '2'">
					<view class="order-detail-info-item">
						<text>服务费</text>
						<text>￥{{jsonData.amount}}</text>
					</view>
				</view>
				<view class="order-detail-info-item">
					<view class="order-detail-info-item-code-left">
						<text>交易流水号</text>
						<view class="order-detail-info-item-code-left-copy" @tap="copyText">复制</view>
					</view>
					<text>{{jsonData.oderId ? jsonData.oderId : jsonData.transOrder}}</text>
				</view>
			</view>
		</view>
		<!-- 机具信息 -->
		<view class="order-detail-list">
			<view class="order-detail-list-item">
				<text>产品名称</text>
				<text>{{$uv.test.empty(jsonData.produceName) ? jsonData.productName : jsonData.produceName}}</text>
				<view class="line"></view>
			</view>
			<view class="order-detail-list-item">
				<text>机具编号</text>
				<text>{{$uv.test.empty(jsonData.ksnNo) ? jsonData.deviceId : jsonData.ksnNo}}</text>
				<view class="line"></view>
			</view>
		</view>
	</view>
</template>

<script setup>
	const props = defineProps(['type','data'])
	const jsonData = JSON.parse(decodeURIComponent(props.data))
	const copyText = ()=>{
		if(jsonData.oderId){
			uni.$utils.copy(jsonData.oderId)
		}
		else{
			uni.$utils.copy(jsonData.transOrder)
		}
	}
</script>

<style lang="scss" scoped>
.order-detail-layout{
	.order-detail-list{
		background-color: #fff;
		.order-detail-list-item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx;
			position: relative;
		}
	}
	.order-detail-info{
		background-color: #fff;
		padding: 30rpx;
		margin: 20rpx 0;
		.order-detail-info-money{
			text-align: center;
			font-size: 68rpx;
			padding-bottom: 30rpx;
		}
		.order-detail-info-item{
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-top: 20rpx;
			.order-detail-info-item-code-left{
				display: flex;
				align-items: center;
				flex-shrink: 0;
				.order-detail-info-item-code-left-copy{
					height: 28rpx;
					line-height: 28rpx;
					width: 60rpx;
					color: #3C3C3C;
					font-size: 18rpx;
					background-color: #e6e6e6;
					border-radius: 14rpx;
					margin-left: 20rpx;
					text-align: center;
				}
			}
		}
	}
}
</style>
